<template>
	<div id="background">
		<el-row>
			<el-col :span="4" :offset="15">
			<el-menu
			  class="el-menu-demo"

			  text-color="#545c64"
			  active-text-color="#ffd04b">
			  <el-submenu index="2">
			    <template slot="title" style="background-color: #0074D9;">{{username}} <img style="height: 30px;" :src="img"></template>
			    <el-menu-item index="2-1"><router-link :to="{name:'usercen'}">个人中心</router-link></el-menu-item>
			    <el-menu-item index="2-2" ><router-link :to="{name:'login'}">退出登录</router-link></el-menu-item>
			  </el-submenu>
			</el-menu>
			</el-col>
		</el-row>
		<el-row class="tac">
		  <el-col :span="4">
		    <el-menu
		      default-active="2"
		      class="el-menu-vertical-demo"
		      @open="handleOpen"
		      @close="handleClose">
		      <el-submenu index="1">
		        <template slot="title">
		          <i class="el-icon-location"></i>
		          <span>商品信息维护</span>
		        </template>
		        <el-menu-item-group>
		          <el-menu-item index="1-1"><router-link :to="{name:'shoptype'}">商品分类维护</router-link></el-menu-item>
		          <el-menu-item index="1-2"><router-link :to="{name:'shop'}">商品维护</router-link></el-menu-item>
		        </el-menu-item-group>
		      </el-submenu>
			  <el-submenu index="2">
			    <template slot="title">
			      <i class="el-icon-location"></i>
			      <span>商品库存维护</span>
			    </template>
			    <el-menu-item-group>
			      <el-menu-item index="1-1"><router-link :to="{name:'inshop'}">入库操作</router-link></el-menu-item>
			      <el-menu-item index="1-2"><router-link :to="{name:'outshop'}">出库操作</router-link></el-menu-item>
				  <el-menu-item index="1-2"><router-link :to="{name:'echarts'}">入库统计</router-link></el-menu-item>
				  <el-menu-item index="1-2">出库统计</el-menu-item>
			    </el-menu-item-group>
			  </el-submenu>
			  <el-submenu index="3">
			    <template slot="title">
			      <span><router-link :to="{name:'uservue'}">用户信息维护</router-link></span>
			    </template>

			  </el-submenu>

		    </el-menu>
		  </el-col>
		  <el-col :span="20">
			  <router-view/>
		  </el-col>
		</el-row>
	</div>

</template>

<script>
	var _this;
	export default {
		created() {
			_this=this;
			this.username=localStorage.getItem("usname");
			this.usid=localStorage.getItem("usid");
			console.log(this.usid)
			this.select();

		},
		data(){
			return{
				usid:'',
				username:'',
				img:''
			}
		},
	    methods: {
	      handleOpen(key, keyPath) {

	      },
	      handleClose(key, keyPath) {

	      },
		  select(){
			  _this.$axios.post(
			  "/user/key",
			  {"usid":this.usid}
			  )
			  .then(
			  function(param){
				  console.log(param);
				  _this.img=param.data.usimg;
				  console.log(_this.img);
			  }
			  )
			  .catch(function(err) {
			  	console.log(err)
			  })
		  },
		  quit(){

		  }
	    }
	  }
</script>

<style>
	#background{
	   background: url(../assets/123.jpg);
	   width: 100%;
	   height: 100%;
	   position: fixed;
	   background-size: 100%100%;
	  }
</style>
